package main

import (
	_ "jsk3data/routers"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	_ "github.com/lib/pq"
	"jsk3data/models"
)

func init() {
	orm.RegisterDriver("mysql", orm.DRPostgres)
	//postgres:="postgresql://root@107.150.12.201:26257/y2t?application_name=cockroach&sslmode=disable"
	postgres:="postgresql://root@localhost:26257/oauth2?sslmode=disable"
	//"root:root@/orm_test?charset=utf8"
	orm.RegisterDataBase("default", "postgres", postgres)
	orm.RegisterModel(new(models.Jsk3))
	orm.RunSyncdb("default", false, true)
}

func main() {
	if beego.BConfig.RunMode == "dev" {
		beego.BConfig.WebConfig.DirectoryIndex = true
		beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
	}
	beego.Run()
}
